<div class="breadcrumbs" id="breadcrumbs">
	<ul class="breadcrumb">
		<li>
			<i class="home-icon fa fa-home"></i>
			<a href="#">会员</a>
		</li>
		<li>
			<a href="#">提现管理</a>
		</li>
		<li class="active">提现申请列表</li>
	</ul>
</div>
<div class="content">
	<form action="#" method="post">
		<table class="table list-table">
			<colgroup>
				<col width="35px" />
				<col  />
				<col width="120px" />
				<col width="120px" />
				<col width="180px" />
				<col width="120px" />
				<col width="90px" />
				<col width="90px" />
				<col width="90px" />
			</colgroup>
			<caption>
                <a class="btn btn-default" onclick="selectAll('id[]')">
                    <i class="fa fa-check"></i>全选
                </a>
                <a class="btn btn-default" onclick="confirm('确定要删除么？',function(){del();});">
                    <i class="fa fa-close"></i>批量删除
                </a>
				<div class="btn-group">
					<button type="button" class="btn btn-default"><i class="fa fa-jpy"></i>余额提现</button>
					<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
						<span class="caret"></span>
						<span class="sr-only"></span>
					</button>
					<ul class="dropdown-menu" role="menu">
						<li><a href="javascript:confirm('直接转账给用户绑定的微信么？',function(){payCountFee('wechatBalance')});"><i class="fa fa-weixin"></i>微信转账</a></li>
						<li><a href="javascript:confirm('已经通过人工线下现金转账么？',function(){payCountFee('offline')});"><i class="fa fa-money"></i>人工线下</a></li>
					</ul>
				</div>
			</caption>
			<thead>
				<tr>
					<th></th>
					<th>用户名</th>
					<th>当前预存款</th>
					<th>申请提现金额</th>
					<th>申请时间</th>
					<th>收款人姓名</th>
					<th>微信绑定</th>
					<th>状态</th>
					<th>操作</th>
				</tr>
			</thead>

			<tbody>
                {set:$queryObj=Api::run('getListByWithdraw',array('status'=>'0,1'));$resultData=$queryObj->find()}
                {foreach:items=$resultData}
				<tr>
					<td><input type="checkbox" name="id[]" value="{$item['id']}" /></td>
					<td>{$item['username']}</td>
					<td>{$item['balance']}</td>
					<td>{$item['amount']} 元</td>
					<td>{$item['time']}</td>
					<td>{$item['name']}</td>
					<td>{if:class_exists("wechat")}{echo:wechat::getOpenidByUser($item['user_id'])?'已绑定':'未绑定'}{/if}</td>
					<td>{echo:AccountLog::getWithdrawStatus($item['status'])}</td>
					<td>
						<a href='{url:/member/withdraw_detail/id/$item['id']}'><i class='operator fa fa-eye'></i></a>
					</td>
				</tr>
				{/foreach}
			</tbody>
		</table>
	</form>
</div>
{$queryObj->getPageBar()}

<script>
//删除
function del()
{
	var ids = [];
	$('[name="id[]"]:checked').each(function()
	{
		ids.push(this.value);
	});

	$.get("{url:/member/withdraw_del}",{"id":ids},function()
	{
		window.location.reload();
	});
}

//支付转账
function payCountFee(type)
{
	var ids = [];
	$('[name="id[]"]:checked').each(function()
	{
		ids.push(this.value);
	});

	if(ids.length == 0)
	{
		alert('请选择要提现的用户');
		return;
	}

	loadding('处理中...');

	$.get("{url:/member/pay_countfee}",{"ids[]":ids,"type":type},function(text)
	{
		unloadding();
		art.dialog.alert(text,function()
		{
			window.setTimeout(function(){window.location.reload();});
		});
	});
}
</script>
